<?php
/**
 * Created by PhpStorm.
 * User: Lenovo
 * Date: 2019/4/24
 * Time: 17:35
 */

namespace app\admin\controller;

use app\admin\model\Bankcard;
use app\admin\model\Qrcode;
use app\admin\model\User as UserModel;
use app\admin\model\Withdrawal;
use app\admin\model\Yuyue;
use app\admin\model\Guanli;
use app\admin\model\Balancelog;
use think\Session;
class User extends Base
{
    public function __construct()
    {
        $this->rs = new UserModel();//会员表模型
        $this->tx = new Withdrawal();//提现表模型
        $this->qr = new Qrcode();//二维码表模型
        $this->bk = new Bankcard();//银行卡表模型
        $this->yu = new Yuyue();//抢单表模型
      	$this->ls = new Balancelog();//流水表
      	$this->gl= new Guanli();
    }
    public function viplist()
    {
        $rs=$this->rs->viplist();
        //dump($rs);die;
        $page=$rs->render();
        return view('viplist',['rs'=>$rs,'page'=>$page]);
    }

    //用户列表详情页面的查看
    public function chakan()
    {
        $uid=input('uid');
        if(request()->isAjax())
        {
            $data=input('post.');
            //$uid=input('uid');
            return $this->rs->vipxiugai($uid,$data);
        }
        else
        {
            $rs=$this->rs->chakan($uid);
          	$guid=Session::get('admin_uid');
          	$did=$this->gl->find();
         	$re=$this->rs->where('uid',$rs['did'])->find();
            return view('chakan',['rs'=>$rs,'uid'=>$uid,'did'=>$did,'re'=>$re]);
        }
    }

    //用户代理状态的改变
    public function daili()
    {
        return $this->rs->daili();
    }

    //用户锁定状态的改变
    public function suoding()
    {
        return $this->rs->suoding();
    }

    //充值显示
    public function chongzhiindex()
    {
        $rs=$this->cz->chongzhiindex();
        $page=$rs->render();
        return view('chongzhiindex',['rs'=>$rs,'page'=>$page]);
    }

    //充值拒绝原因
    public function chongzhireason()
    {
        if(request()->isAjax())
        {
            return $this->cz->chongzhireason();
        }
        else
        {
            $cid=input('cid');
            return view('chongzhireason',['cid'=>$cid]);
        }
    }

    //充值到账
    public function  chongzhi()
    {
        return $this->cz->chongzhi();
    }

    //提现列表显示
    public function tixianindex()
    {
        $rs=$this->tx->tixianindex();
        $page=$rs->render();
        return view('tixianindex',['rs'=>$rs,'page'=>$page]);
    }
    //提现到账的操作
    public function daozhang()
    {
       return $rs=$this->tx->daozhang();
    }
    //提现拒绝原因
    public function tixianreason()
    {
        if(request()->isAjax())
        {
            return $this->tx->tixianreason();
        }
        else
        {
            $wid=input('wid');
            //echo $wid;die;
            return view('tixianreason',['wid'=>$wid]);
        }
    }

    //二维码管理的显示
    public function qrcodeindex()
    {
        $rs=$this->qr->qrcodeindex();
        $page=$rs->render();
        return view('qrcodeindex',['rs'=>$rs,'page'=>$page]);
    }

    //二维码锁定状态的改变
    public function qrstate()
    {
        return $this->qr->qrstate();
    }

    //银行卡管理的显示
    public function bankindex()
    {
        $rs=$this->bk->bankindex();
        $page=$rs->render();
        return view('bankindex',['rs'=>$rs,'page'=>$page]);
    }

    //银行卡锁定状态的改变
    public function bankstate()
    {
        return $this->bk->bankstate();
    }

    //资金流水的显示
     public function balancelogindex()
     {
        $rs=$this->ls->balancelogindex();
        $page=$rs->render();
        return view('balancelog',['rs'=>$rs,'page'=>$page]);
     }
}